{subtemplate header}

<div class="subtable nav" style="width: {TABLEWIDTH}">
<img src="{IMGDIR}/map.png" align="absmiddle" alt="You are here" class="map" /><a href="$bbsdir/$indexname">$bbname</a> $navigation &raquo; {lang post_newreply}
</div></div>

<script type="text/javascript" src="$jsdir/post.js"></script>
<script type="text/javascript">
var postminchars = parseInt('$minpostsize');
var postmaxchars = parseInt('$maxpostsize');
var disablepostctrl = parseInt('$disablepostctrl');
var bbinsert = parseInt('$bbinsert');
var seccodecheck = parseInt('$seccodecheck');
var secqaacheck = parseInt('$secqaacheck');
function checklength(theform) {
	var message = bbinsert && wysiwyg ? html2bbcode(getEditorContents()) : (!theform.parseurloff.checked ? parseurl(theform.message.value) : theform.message.value);
	var showmessage = postmaxchars != 0 ? '{lang board_allowed}: ' + postminchars + ' {lang lento} ' + postmaxchars + ' {lang bytes}' : '';
	alert('\n{lang post_curlength}: ' + mb_strlen(message) + ' {lang bytes}\n\n' + showmessage);
}
function validate(theform, previewpost) {
	var message = bbinsert && wysiwyg ? html2bbcode(getEditorContents()) : (!theform.parseurloff.checked ? parseurl(theform.message.value) : theform.message.value);
	if(message == "" && theform.subject.value == "") {
		alert("{lang post_subject_and_message_isnull}");
		theform.message.focus();
		return false;
	} else if(mb_strlen(theform.subject.value) > 80) {
		alert("{lang post_subject_toolong}");
		theform.subject.focus();
		return false;
	}
	if(!disablepostctrl && ((postminchars != 0 && mb_strlen(message) < postminchars) || (postmaxchars != 0 && mb_strlen(message) > postmaxchars))) {
		alert("{lang post_message_length_invalid}\n\n{lang post_curlength}: "+mb_strlen(message)+" {lang bytes}\n{lang board_allowed}: "+postminchars+" {lang lento} "+postmaxchars+" {lang bytes}");
		return false;
	}
	theform.message.value = message;
	seccheck(theform, seccodecheck, secqaacheck, previewpost);
	return true;
}
</script>

{subtemplate post_preview}

<form method="post" id="postform" action="post.php?action=reply&fid=$fid&tid=$tid&extra=$extra&replysubmit=yes" $enctype onSubmit="validate(this);return false;">
<input type="hidden" name="formhash" id="formhash" value="{FORMHASH}">
<div class="maintable">
<table cellspacing="{INNERBORDERWIDTH}" cellpadding="{TABLESPACE}" width="99%">
<!--{if $discuz_uid}-->
	<tr><td class="altbg1"><span class="bold">{lang username}</span></td>
	<td class="altbg2">$discuz_userss <span class="smalltxt">[<a href="$link_logout">{lang member_logout}</a>]</span></td>
	</tr>
<!--{/if}-->

<!--{if $seccodecheck}-->
	<tr><td class="altbg1"><span class="bold">{lang seccode}</span></td>
	<td class="altbg2"><div id="seccodeimage"></div><input type="text" name="seccodeverify" id="seccodeverify" size="4" maxlength="4"> <span class="smalltxt">{lang secode_refresh}</span>
	<script type="text/javascript">
	<!--{if $attackevasive & 1}-->
		setTimeout("updateseccode($seccodedata['width'], $seccodedata['height'])", 2001);
	<!--{else}-->
		updateseccode($seccodedata['width'], $seccodedata['height'])
	<!--{/if}-->
	</script></td>
<!--{/if}-->
<!--{if $secqaacheck}-->
	<tr><td class="altbg1"><span class="bold">{lang secqaa}</span></td>
	<td class="altbg2"><div id="secquestion"></div><input type="text" name="secanswer" id="secanswer" size="25" maxlength="50">
	<script type="text/javascript">
	<!--{if $attackevasive & 1}-->
		<!--{if $seccodecheck}-->
			setTimeout("updatesecqaa()", 4002);
		<!--{else}-->
			setTimeout("updatesecqaa()", 2001);
		<!--{/if}-->
	<!--{else}-->
		updatesecqaa();
	<!--{/if}-->
	</script></td>
	</tr>
<!--{/if}-->

<tr>
<td class="altbg1" width="20%"><span class="bold">{lang subject}</span></td>
<td class="altbg2"><input type="text" name="subject" id="subject" size="45" value="$subject" tabindex="3">&nbsp; <span class="smalltxt">({lang optional})</span></td>
</tr>

<tr class="bottom">
<td class="altbg1" valign="top">
{subtemplate post_sminsert}
<input class="checkbox" type="checkbox" name="parseurloff" id="parseurloff" value="1" $urloffcheck> {lang disable} {lang post_parseurl}<br>
<input class="checkbox" type="checkbox" name="smileyoff" id="smileyoff" value="1" $smileyoffcheck> {lang disable} {faq smilies}<br>
<input class="checkbox" type="checkbox" name="bbcodeoff" id="bbcodeoff" value="1" $codeoffcheck> {lang disable} {faq discuzcode}<br>
<!--{if $allowhtml}--><input class="checkbox" type="checkbox" name="htmlon" id="htmlon" value="1" $htmloncheck> {lang enable} {lang post_html}<br><!--{/if}-->
<!--{if $allowanonymous}--><input class="checkbox" type="checkbox" name="isanonymous" value="1"> {lang post_anonymous}<br><!--{/if}-->
<input class="checkbox" type="checkbox" name="usesig" value="1" $usesigcheck> {lang post_show_sig}<br>
<input class="checkbox" type="checkbox" name="emailnotify" value="1" $emailcheck> {lang post_email_notify}
</td>

<td align="left" class="altbg2" valign="top">
<div id="$editorid">
{subtemplate post_bbinsert}
<div class="editor_text"><textarea name="message" rows="10" cols="60" style="width:100%; height:350px;" tabindex="100" id="{$editorid}_textarea" onSelect="javascript: storeCaret(this);" onClick="javascript: storeCaret(this);" onKeyUp="javascript:storeCaret(this);" onKeyDown="ctlent(event);">$message</textarea></div>
<table width="100%" cellpadding="{TABLESPACE}" cellspacing="0" class="editor_button"><tr><td>
<div class="editor_textexpand"><img src="images/common/bb_contract.gif" width="11" height="21" title="{lang post_discuzcode_contract}" alt="{lang post_discuzcode_contract}" onclick="resizeEditor(-100)" /><img src="images/common/bb_expand.gif" width="11" height="21" title="{lang post_discuzcode_expand}" alt="{lang post_discuzcode_expand}" onclick="resizeEditor(100)" /></div>
</td><td align="right">
<input type="button" class="lightbutton" value="{lang post_check_length}" onclick="checklength($('postform'))">
<input type="button" class="lightbutton" name="previewbutton" id="previewbutton" value="{lang post_previewpost}" tabindex="102" onclick="previewpost()">
<input type="button" class="lightbutton" name="restoredata" id="restoredata" value="{lang post_autosave_restore}" tabindex="103" title="{lang post_autosave_last_restore}" onclick="loadData()">
<input type="button" class="lightbutton" value=" {lang post_topicreset} " tabindex="104" onclick="clearcontent()">
</td>
<!--{if $allowpostattach}-->
	<tr><td colspan="2">
	{subtemplate post_attachments}
	</td></tr>
<!--{/if}-->
</table>
</div>

<div class="postsubmit">
<input class="button" type="submit" name="replysubmit" id="postsubmit" value="{lang post_newreply}" tabindex="101">
<input type="hidden" name="wysiwyg" id="{$editorid}_mode" value="$editormode">
<input type="hidden" name="fid" id="fid" value="$fid">
{lang post_submit_hotkey}
</div>

</td></tr></table></div>

</form>

<div class="maintable">
<table cellspacing="{INNERBORDERWIDTH}" cellpadding="{TABLESPACE}" width="99%" align="center">
<tr class="header">
<td colspan="2">{lang post_thread_review}</td>
</tr>

<!--{if $thread['replies'] > $ppp}-->
	<tr class="altbg1"><td colspan="2" valign="top" width="20%">{lang post_replies_toolong}</td></tr>
<!--{else}-->
	<!--{loop $postlist $post}-->
		<tr>
		<td class="altbg1" valign="top" width="20%"><span class="bold"><!--{if $post['author'] && !$post['anonymous']}-->$post[author]<!--{else}-->{lang anonymous}<!--{/if}--></span><br><br></td>
		<td class="altbg2"><span class="smalltxt">{lang poston} $post[dateline]</span><br>
		<table height="100%" width="100%" border="0" cellspacing="0" cellpadding="0" class="line t_msg">
		<tr><td><p>$post[message]</p><br></td></tr></table></td></tr>
	<!--{/loop}-->
<!--{/if}-->
</table>

<script type="text/javascript">
	var textobj = $(editorid + '_textarea');
	<!--{if $bbinsert}-->newEditor(wysiwyg);<!--{/if}-->
	checkFocus();
	setCaretAtEnd();
	if(!(is_ie >= 5 || is_moz >= 2)) {
		$('restoredata').style.display = 'none';
	}
</script>

{subtemplate footer}